---
title: "Org-mode Table（表格）"
date: 2019-3-1
categories:
- emacs
- org-mode
tags:
---

<div id="content">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org6f2b206">Intro</a></li>
<li><a href="#org1f35dab">创建表格</a></li>
<li><a href="#orgef12418">快捷键</a>
<ul>
<li><a href="#org29499fa">Creation and conversion</a></li>
<li><a href="#org3a5a9bd">重新对齐与单元格移动</a></li>
<li><a href="#org05bd426">行和列的编辑</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-org6f2b206">
<h2 id="org6f2b206">Intro</h2>
<div class="outline-text-2" id="text-org6f2b206">
<p>
Org-mode 提供了比markdown更加强大的表格支持。
任何以‘|’为首个非空字符的行都会被认为是表格的一部分。’|‘也是列分隔符:
</p>
<table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups">
<colgroup>
<col class="org-left"/>
<col class="org-right"/>
<col class="org-right"/>
</colgroup>
<thead>
<tr>
<th class="org-left" scope="col">Name</th>
<th class="org-right" scope="col">Phone</th>
<th class="org-right" scope="col">Age</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Peter</td>
<td class="org-right">1234</td>
<td class="org-right">17</td>
</tr>
<tr>
<td class="org-left">Anna</td>
<td class="org-right">4321</td>
<td class="org-right">25</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="outline-2" id="outline-container-org1f35dab">
<h2 id="org1f35dab">创建表格</h2>
<div class="outline-text-2" id="text-org1f35dab">
<p>
要创建上面的表格，只需要输入
</p>
<table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups">
<colgroup>
<col class="org-left"/>
<col class="org-left"/>
<col class="org-left"/>
</colgroup>
<tbody>
<tr>
<td class="org-left">Name</td>
<td class="org-left">Phone</td>
<td class="org-left">Age</td>
</tr>
</tbody>
</table>
<p>
然后按TAB就行了。或者输入
</p>
<div class="org-src-container">
<pre class="src src-org">|Name|Phone|Age 
</pre>
</div>
<p>
然后按 {% raw %} C-c RET {% endraw %}
</p>
</div>
</div>
<div class="outline-2" id="outline-container-orgef12418">
<h2 id="orgef12418">快捷键</h2>
<div class="outline-text-2" id="text-orgef12418">
<p>
每次在表格中按 {% raw %} TAB {% endraw %}, {% raw %} RET {% endraw %}, {% raw %} C-c C-c {% endraw %}, 表格都会被自动对齐。
</p>
</div>
<div class="outline-3" id="outline-container-org29499fa">
<h3 id="org29499fa">Creation and conversion</h3>
<div class="outline-text-3" id="text-org29499fa">
<table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups">
<colgroup>
<col class="org-left"/>
<col class="org-left"/>
<col class="org-left"/>
</colgroup>
<thead>
<tr>
<th class="org-left" scope="col">Shortcut</th>
<th class="org-left" scope="col">Command</th>
<th class="org-left" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">C-c 竖线</td>
<td class="org-left"> </td>
<td class="org-left">能够交互式地创建表格</td>
</tr>
<tr>
<td class="org-left">C-c</td>
<td class="org-left">org-table-create-or-convert-from-region</td>
<td class="org-left">将区域转换为表格</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="outline-3" id="outline-container-org3a5a9bd">
<h3 id="org3a5a9bd">重新对齐与单元格移动</h3>
<div class="outline-text-3" id="text-org3a5a9bd">
<table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups">
<colgroup>
<col class="org-left"/>
<col class="org-left"/>
<col class="org-left"/>
</colgroup>
<thead>
<tr>
<th class="org-left" scope="col">Shortcut</th>
<th class="org-left" scope="col">Command</th>
<th class="org-left" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">C-c C-c</td>
<td class="org-left">org-table-align</td>
<td class="org-left">在不移动光标的情况下重排表格</td>
</tr>
<tr>
<td class="org-left">TAB</td>
<td class="org-left">org-table-next-field</td>
<td class="org-left">移动到下一个单元格</td>
</tr>
<tr>
<td class="org-left">S-TAB</td>
<td class="org-left">org-table-previous-field</td>
<td class="org-left">移动到上一单元格</td>
</tr>
<tr>
<td class="org-left">C-c SPC</td>
<td class="org-left">org-table-blank-field</td>
<td class="org-left">清空单元格</td>
</tr>
<tr>
<td class="org-left">RET</td>
<td class="org-left">org-table-next-row</td>
<td class="org-left">移动到下一行，在表格结尾加新行</td>
</tr>
<tr>
<td class="org-left">M-a</td>
<td class="org-left">org-table-beginning-of-field</td>
<td class="org-left">移动到单元格文本头部，或者到上一个单元格</td>
</tr>
<tr>
<td class="org-left">M-e</td>
<td class="org-left">org-table-end-of-field</td>
<td class="org-left">移动到单元格文本尾，或者到下一个单元格</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="outline-3" id="outline-container-org05bd426">
<h3 id="org05bd426">行和列的编辑</h3>
<div class="outline-text-3" id="text-org05bd426">
<table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups">
<colgroup>
<col class="org-left"/>
<col class="org-left"/>
<col class="org-left"/>
</colgroup>
<thead>
<tr>
<th class="org-left" scope="col">Shortcut</th>
<th class="org-left" scope="col">Command</th>
<th class="org-left" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">M-LEFT/RIGHT</td>
<td class="org-left"> </td>
<td class="org-left">移动列</td>
</tr>
<tr>
<td class="org-left">M-UP/DOWN</td>
<td class="org-left"> </td>
<td class="org-left">移动行</td>
</tr>
<tr>
<td class="org-left">M-S-LEFT/RIGHT</td>
<td class="org-left"> </td>
<td class="org-left">删除/插入列</td>
</tr>
<tr>
<td class="org-left">M-S-UP/DOWN</td>
<td class="org-left"> </td>
<td class="org-left">删除/插入行</td>
</tr>
<tr>
<td class="org-left">C-c -</td>
<td class="org-left"> </td>
<td class="org-left">添加水平分割线</td>
</tr>
<tr>
<td class="org-left">C-c RET</td>
<td class="org-left"> </td>
<td class="org-left">添加水平分割线并跳到下一行</td>
</tr>
<tr>
<td class="org-left">C-c ^</td>
<td class="org-left"> </td>
<td class="org-left">根据当前列排序，可以选择排序方式</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="status" id="postamble">
<p class="date">Date: 2019-3-1</p>
<p class="author">Author: gdme1320</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
